<include file="Layout/header" />

<body>
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
        try { ace.settings.check('breadcrumbs', 'fixed') } catch (e) {}
        </script>
        <ul class="breadcrumb">
            <li> <i class="icon-home home-icon"></i> <a href="{:U('Admin/Index/welcome')}">首页</a> </li>
            <li class="active">分红列表</li>
        </ul>
    </div>
    <div class="page-content">
        <div class="page-header">
            <h1> 代理管理 <small> <i class="icon-double-angle-right"></i> 分红列表 </small> </h1>
        </div>
        <div class="row">
            <form method="get" action="{:U('Admin/Agent/fenhong_list')}">
                <table class="table table-striped table-bordered table-hover table-condensed">
                    <tr>
                        <td width="15%">
                            <input class="col-xs-12 col-sm-8" type="text" name="member_name" placeholder="会员名称">
                        </td>
                        <td width="20%">
                            <input class="btn btn-success" type="submit" value="搜索">
                        </td>
                    </tr>
                </table>
            </form>
            <div class="col-xs-12">
                <!--  <a class="btn btn-primary" style="margin-bottom: 5px;" href="{:U('Admin/Member/member_add')}"><i class="icon-plus align-top bigger-125"></i>新增会员</a>-->
                <div class="table-responsive">
                    <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>会员名称</th>
                                <th class="hidden-480">下注总金额</th>
                                <th class="hidden-480">盈利</th>
                                <th>分红</th>
                                <th>添加时间</th>
                                <!--
              <th>操作</th> -->
                            </tr>
                        </thead>
                        <tbody>
                            <form method="post" action="{:U('Admin/Lottryodds/both_del')}" id="ondel">
                                <volist name="info" id="vo">
                                    <tr class="selected">
                                        <td>{$vo.id}</td>
                                        <td>{$vo.agent_name}</td>
                                        <td class="hidden-480">{$vo.money}</td>
                                        <td class="hidden-480">{$vo.money_win}</td>
                                        <td>{$vo.fenhong}</td>
                                        <td>{$vo.add_time|date="Y-m-d H:i:s",###}</td>
                                        <!--  <td><div class="visible-md visible-lg hidden-sm hidden-xs btn-group">



                    <a class="btn btn-xs btn-danger" onClick="lottryodds_del(this,{$vo.id})"> <i class="icon-trash bigger-120"></i> </a> </div></td> -->
                                    </tr>
                                </volist>
                            </form>
                        </tbody>
                    </table>
                    <div>{$page}</div>
                    <div>
                        <!--   <button class="btn btn-danger" onClick="datadel()">批量删除</button> -->
                        <button class="btn btn-primary" onClick="balance_a()">结算</button>
                        <!--   <button class="btn  btn-primary" onClick="balance_b()">结算C盘</button> -->
                    </div>
                </div>
                <input type="hidden" value="{:U('Admin/DLJS/dl_fenhong')}" id="lottryodds_dla">
                <!-- /.table-responsive -->
            </div>
        </div>
    </div>
    <include file="Layout/js" />
    <link href="__ADMIN_CSS__/datepicker.css" rel="stylesheet" />
    <script src="__ADMIN_JS__/date-time/bootstrap-datepicker.min.js"></script>
    <script src="__ADMIN_JS__/jquery.ui.touch-punch.min.js"></script>
    <script src="__ADMIN_JS__/jquery.dataTables.min.js"></script>
    <script src="__ADMIN_JS__/jquery.dataTables.bootstrap.js"></script>
    <script src="__ADMIN_JS__/bootbox.js"></script>
    <script type="text/javascript">
    jQuery(function($) {
        $("#datepicker").datepicker({
            showOtherMonths: true,
            selectOtherMonths: false,

        });

        $("#datepicker1").datepicker({
            showOtherMonths: true,
            selectOtherMonths: false,

        });

        var oTable1 = $('#sample-table-2').dataTable({
            "aoColumns": [
                { "bSortable": false },
                null, null, null, null, null,
                { "bSortable": false }
            ]
        });


        $('table th input:checkbox').on('click', function() {
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function() {
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });

        });


    })
    </script>
    <script type="text/javascript">
    /*资讯-下架*/
    function member_stop(obj, id) {
        var host = $("#member_show").val();
        bootbox.setLocale("zh_CN");
        bootbox.confirm("确定禁用该会员?", function(result) {
            if (result) {
                $.ajax({
                    url: host,
                    type: "POST",
                    dataType: "json",
                    data: { member_id: id },
                    success: function(s) {
                        if (s.status == '1') {
                            $(obj).parents("tr").find(".btn-group").prepend('<a class="btn btn-xs btn-success" onClick="member_stop(this,' + id + ')" href="javascript:;" title="发布"><i class="icon-ok bigger-120"></i> </a>');
                            $(obj).parents("tr").find(".td-status").html('<span class="label label-sm label-inverse arrowed-in">禁用</span>');
                            $(obj).remove();
                            bootbox.alert('已禁用!');
                        } else {
                            bootbox.alert(s.info);
                        }
                    }
                });


            }
        });
    }

    /*资讯-发布*/
    function member_start(obj, id) {
        var host = $("#member_show").val();
        bootbox.setLocale("zh_CN");
        bootbox.confirm("确定开启该会员?", function(result) {
            if (result) {
                $.ajax({
                    url: host,
                    type: "POST",
                    dataType: "json",
                    data: { id: id },
                    success: function(s) {
                        if (s.status == '1') {
                            $(obj).parents("tr").find(".btn-group").prepend('<a class="btn btn-xs btn-inverse" onClick="member_stop(this,' + id + ')" href="javascript:;"> <i class=" icon-ban-circle bigger-120"></i>');
                            $(obj).parents("tr").find(".td-status").html('<span class="label label-sm label-success">开启</span>');
                            $(obj).remove();
                            bootbox.alert('已开启!');
                        } else {
                            bootbox.alert(s.info);
                        }
                    }
                });


            }
        });
    }
    /*文章-删除*/
    function lottryodds_del(obj, id) {
        var host = $("#lottryodds_del").val();
        bootbox.setLocale("zh_CN");
        bootbox.confirm("确定删除该信息?", function(result) {
            if (result) {
                $.ajax({
                    url: host,
                    type: "POST",
                    dataType: "json",
                    data: { id: id },
                    success: function(s) {
                        if (s.status == '1') {
                            $(obj).parents("tr").remove();
                            bootbox.alert('删除成功');
                        } else {
                            bootbox.alert(s.info);
                        }
                    }
                })


            }
        });

    }
    /*批量-删除*/
    function datadel() {
        var is_check = $("input[type='checkbox']").is(':checked');
        if (is_check) {
            bootbox.setLocale("zh_CN");
            bootbox.confirm("确定删除这些信息?", function(result) {
                if (result) {
                    $("#ondel").submit();
                }
            });
        } else {
            bootbox.alert({
                buttons: {
                    ok: {
                        label: '返回',
                        className: 'btn-myStyle'
                    }
                },
                message: '请选择要删除的信息',
                callback: function() {
                    // alert('关闭了alert');
                },
                title: "提示信息",
            });


        }

    }
    /*批量-结算A*/
    function balance_a() {

        var host = $("#lottryodds_dla").val();
        bootbox.setLocale("zh_CN");
        bootbox.confirm("确定要结算分红吗?", function(result) {
            if (result) {
                $.ajax({
                    url: host,
                    type: "GET",
                    dataType: "json",
                    data: { type: 1 },
                    success: function(s) {
                        if (s.status == 0) {
                            bootbox.alert(s.info);
                        } else if (s.status == '-1') {
                            bootbox.alert('没有数据要结算!');
                        } else {
                            bootbox.alert('所有分红已结算!');
                        }
                    }
                });


            }
        });

    }
    /*批量-结算C*/
    function balance_b() {

        var host = $("#lottryodds_dlc").val();

        bootbox.setLocale("zh_CN");
        bootbox.confirm("确定要结算C盘反水吗?", function(result) {
            if (result) {
                $.ajax({
                    url: host,
                    type: "GET",
                    dataType: "json",
                    data: { type: 1 },
                    success: function(s) {
                        if (s.status == 0) {
                            bootbox.alert(s.info);
                        } else if (s.status == '-1') {
                            bootbox.alert('没有数据要结算!');
                        } else {
                            bootbox.alert('所有C盘反水已结算!');
                        }
                    }
                });


            }
        });

    }
    </script>
</body>

</html>